package com.kefu.chat.smart;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.kefu.chat.model.ChatUser;
import com.kefu.chat.vo.ChatUserParam.UserConnectP;
import com.kefu.chat.vo.ChatUserParam.UserConnectR;
import com.kefu.common.trigger.TriggerWrapper;
import com.kefu.common.trigger.action.SmartAction;
import com.kefu.crm.model.CrmCustomer;

public interface ChatConnectAction extends SmartAction<UserConnectP,UserConnectR> {

	static Logger logger=LoggerFactory.getLogger(ChatConnectAction.class);
	
	default String type() {
		return ChatConnectEvent.TYPE;
	}

	
	default  ChatUser getChatUser(TriggerWrapper<UserConnectP,UserConnectR> wrapper) {
		return (ChatUser)wrapper.getMap().get("chatUser");
	}
	default  CrmCustomer getCustomer(TriggerWrapper<UserConnectP,UserConnectR> wrapper) {
		return (CrmCustomer)wrapper.getMap().get("customer");
	}

	default String getMessageCodePrefix() {
		return "smart.chat.action."+getCode()+".";
	}
	default String getMessageName() {
		return getMessage("smart.chat.action."+getCode(),getName());
	}
}
